/**
 * 文件: SearchResult.java
 * 项目: DFlow
 * 版权所有者:佛山市顺德区北航工业设计有限公司
 * 
 */
package common.bean;

import java.util.*;


public class SearchResult<T> implements List<T>{
	private int total = 0;
	private int totalPage = 1;
	private int pageIdx = 1;
	private int pageSize = 20;
	
	
	
	private List<T> result = new ArrayList<T>();

	
	public int getTotal() {
		return total;
	}

	public void setTotal(int total) {
		this.total = total;
	}

	public int getPageIdx() {
		return pageIdx;
	}

	public void setPageIdx(int pageIdx) {
		this.pageIdx = pageIdx;
	}

	public int getPageSize() {
		return pageSize;
	}

	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}

	public List<T> getResult() {
		return result;
	}

	public void setResult(List<T> result) {
		this.result = result;
	}

	public boolean isUniqueObject(){
		return result.size() == 1 ? true : false;
	}
	
	public boolean isEmptyResult(){
		return result.size() > 0 ? false : true;
	}
	
	public T getFirstObject(){
		return result.get(0);
	}
	
	
	
	public int getTotalPage() {
		return totalPage;
	}

	public void setTotalPage(int totalPage) {
		this.totalPage = totalPage;
	}

	// -------------------delegate method start here ------------------------------------------- 
	public int size() {
		return result.size();
	}

	public boolean isEmpty() {
		return result.isEmpty();
	}

	public boolean contains(Object o) {
		return result.contains(o);
	}

	public Iterator<T> iterator() {
		return result.iterator();
	}

	public Object[] toArray() {
		return result.toArray();
	}

	public <T> T[] toArray(T[] a) {
		return result.toArray(a);
	}

	public boolean add(T e) {
		return result.add(e);
	}

	public boolean remove(Object o) {
		return result.remove(o);
	}

	public boolean containsAll(Collection<?> c) {
		return result.containsAll(c);
	}

	public boolean addAll(Collection<? extends T> c) {
		return result.addAll(c);
	}

	public boolean addAll(int index, Collection<? extends T> c) {
		return result.addAll(index, c);
	}

	public boolean removeAll(Collection<?> c) {
		return result.removeAll(c);
	}

	public boolean retainAll(Collection<?> c) {
		return result.retainAll(c);
	}

	public void clear() {
		result.clear();
	}

	public boolean equals(Object o) {
		return result.equals(o);
	}

	public int hashCode() {
		return result.hashCode();
	}

	public T get(int index) {
		return result.get(index);
	}

	public T set(int index, T element) {
		return result.set(index, element);
	}

	public void add(int index, T element) {
		result.add(index, element);
	}

	public T remove(int index) {
		return result.remove(index);
	}

	public int indexOf(Object o) {
		return result.indexOf(o);
	}

	public int lastIndexOf(Object o) {
		return result.lastIndexOf(o);
	}

	public ListIterator<T> listIterator() {
		return result.listIterator();
	}

	public ListIterator<T> listIterator(int index) {
		return result.listIterator(index);
	}

	public List<T> subList(int fromIndex, int toIndex) {
		return result.subList(fromIndex, toIndex);
	}
	
// -------------------delegate method end here ------------------------------------------- 
	
}